/**
 * @description 入库流程
 * 1. 确认到货（一定会有）
 * 2. 称重清点 
 * 3. 质检
 * 4. 上架
 * 5. 更新库存（一定会有）
 */

/**
 * @description 入库流程
 */
abstract class InStorage {

  templateMethod() {
    this.confirmArrival()
    this.weight()
    this.quality()
    this.putOn()
    this.updateStock()
  }
  private confirmArrival() {
    console.log('确认到货');
  }
  protected abstract weight(): void
  protected abstract quality(): void
  protected abstract putOn(): void

  private updateStock() {
    console.log('更新库存');
  }
}

/**
 * @description 蔬果入库
 */
class InStorageVf extends InStorage {
  protected weight(): void {
    console.log('称重清点');
  }
  protected quality(): void {
    console.log('质检');
  }
  protected putOn(): void {
    console.log('上架');
  }
}

/**
 * @description 百货入库
 */
class InStorageGeneral extends InStorage {
  protected weight(): void { }
  protected quality(): void { }
  protected putOn(): void {
    console.log('上架');
  }
}

/**
 * @description 水产入库
 */
class InStorageFish extends InStorage {
  protected weight(): void { }

  protected quality(): void {
    console.log('质检');
    // 质检新增流程
    this.medicine()
  }
  protected putOn(): void { }

  protected medicine() {
    console.log('药检');
  }
}

const in1 = new InStorageVf()
in1.templateMethod()
console.log('----------');
const in2 = new InStorageGeneral()
in2.templateMethod()
console.log('----------');
const in3 = new InStorageFish()
in3.templateMethod()

